import java.util.*;

class Test {
	public static void main(String[] args) {
		Date date=new Date();
		GregorianCalendar calendar=new GregorianCalendar();

		calendar.setTime(date);
		System.out.println(date);
		printCalendar(calendar);

		calendar.set(Calendar.WEEK_OF_MONTH,1);
		printCalendar(calendar);

		calendar.add(Calendar.HOUR, 5);
		printCalendar(calendar);

		System.out.println(calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
	}

	static void printCalendar(Calendar calendar) {
		System.out.println(
			calendar.get(Calendar.YEAR) + "-" +
			(calendar.get(Calendar.MONTH)+1) + "-" +
			calendar.get(Calendar.DATE) + " " +
			calendar.get(Calendar.HOUR_OF_DAY) + ":" +
			calendar.get(Calendar.MINUTE) + ":" +
			calendar.get(Calendar.SECOND)
		);
		System.out.println();
	}
}
